package top.lyc829.leetcode.T371;

public class Solution {
    public int getSum(int a, int b) {

        while (b != 0) {
            int tmp = a ^ b;
            b = (a & b) << 1;
            a = tmp;
        }

        return a;
    }

    public int getReduce(int a, int b) {
        b = ~b + 1;
        return getSum(a, b);
    }

    public static void main(String[] args) {

        Solution s = new Solution();
        //int res = s.getSum(5, 3);
        int res = s.getReduce(3, 5);
        System.out.println(res);
    }

}
